package com.briup.day22;

import java.io.*;

public class Test_Copy {
    public static void main(String[] args) throws Exception {

        InputStream is = new FileInputStream("01-Basic/src/dir/a.txt");
        OutputStream os = new FileOutputStream("01-Basic/src/dir/b.txt");
//        逐字写入数据
        int r;//返回读取到的有效字节

//        2.以小数组的方式写入数据
        byte[] buf =new byte[8];
        //r表示读取到的有效数目
        while ((r = is.read(buf)) != -1) {
            os.write(buf, 0, r);
        }




//        while ((r = is.read()) != -1) {
//            os.write(r);
//        }
        is.close();
        os.close();
    }
}
